package com.zhonghan.recharge.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zhonghan.common.bean.Result;
import com.zhonghan.recharge.service.ActivityService;

@Controller
public class ActivityController {
	
	@Autowired
	private ActivityService activityService;
	
	@RequestMapping("/activity/newactivity")
	public String showNewActivity(HttpServletRequest request,HttpServletResponse response){
				
		return "newactivity";
	}
	
	/**
	 * 跳转到添加活动页面
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/activity/addActivity")
	public String showAddActivity(HttpServletRequest request,HttpServletResponse response){
		
		return "admin/addActivity";
	}
	
	/**
	 * 保存活动
	 * @param request
	 * @param response
	 * @param activityName 活动名称
	 * @param activityUrl  活动链接
	 * @param beginTime    开始时间
	 * @param endTime      结束时间
	 * @param activityDescription 活动描述
	 * @return
	 */
	@RequestMapping("/activity/addActivity/save")
	@ResponseBody
	public Result saveActivity(HttpServletRequest request,HttpServletResponse response,String activityName,String activityUrl,String beginTime,String endTime,String activityDescription){
		
		Result result = activityService.saveActivity(activityName,activityUrl,beginTime,endTime,activityDescription);
		
		return result;
		
	}
	
	
}
